﻿using FriendStar.Data;
using FriendStar.Domain;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FriendStar.Repository.Infrastructure
{
    public class GetDocumentNum 
    {
        private static object lockobj = new object();
       public static string GetNum(string useUnit, string facNum, string itemDesc, string createBy, string documentNum, string documentNumType)
        {
            try
            {
                lock (lockobj)
                {
                    using (var db = new RepositoryBase())
                    {
                       var pars=SqlSugar.SqlSugarTool.GetParameters(new { UseUnit = useUnit, FFacNum = facNum, FItemDesc = itemDesc, FCreateBy = createBy, DocumentNum = documentNum, DocumentNumType = documentNumType });
                        pars[4].Direction = System.Data.ParameterDirection.Output;
                        db.ExecuteStoredProcedure<string>("GetDocumentNum", pars);
                        return pars[4].Value+"";
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

       
    }
}
